﻿@model UserListViewModel
@{
    ViewBag.Title = "Users";
    Layout = "~/Views/Shared/WorkerLayout.cshtml";
}

<h2>Użytkownicy</h2>

@if (Model != null)
{
    <table class="list">
            <thead>
                <tr>
                    <td>Typ</td>
                    <td>Imię</td>
                    <td>Nazwisko</td>
                    <td>Nazwa użytkownika</td>
                    <td>Email</td>
                    <td>Zarejestrowany</td>
                    <td></td>
                    @*<td></td>*@
                </tr>
            </thead>
             @foreach (Users user in Model.Users)
             {
                 <tr>
                    <td>@String.Format("{0}", user.UserRoleID == 1 ? "Klient" : "Pracownik")</td>
                    <td>@user.Customers.Persons.PersonFirstName</td>
                    <td>@user.Customers.Persons.PersonLastName</td>
                    <td>@user.UserDisplayName</td>
                    <td>@user.UserEmail</td>
                    <td>@user.UserDateCreated.ToString("dd.MM.yyyy")</td>
                    <td>@Html.ActionLink("Edytuj", "UserEdit", new { userGuid = user.UserGuid })</td>
                    @*<td>@Html.ActionLink("Usuń", "UserDelete", new { userGuid = user.UserGuid })</td>*@
                 </tr>
             }
    </table>
    
    <div class="pagesNavigation">
        @Html.PageLinks(Model.PagingInfo, x => Url.Action("Users", new { page = x }))
    </div>
}
else
{
    <p style="color:Red;">Nie odnaleziono użytkowników</p> 
}